#ifndef CIRCLETREE_H
#define CIRCLETREE_H

#include "../filter_PCA+Hough/inc/Circle.h"

class CircleTree : public Circle
{
public:
    int idTree ; // id of the tree containaing the circle - default: -1

    inline CircleTree() {idTree = -1 ;}
    inline CircleTree(int id) {idTree = id ;}
    inline CircleTree(Circle c, int idTree_ = -1) : Circle (c)
    {
        idTree = idTree_ ;
    }
    inline CircleTree(const CircleTree &c) : Circle(c)
    {
        this->idTree = c.idTree ;
    }


    ~CircleTree() {}

    // Flags type
    typedef int FlagType;
    int &Flags() { static int dummyflags(0);  assert(0); return dummyflags; }
    int Flags() const { return 0; }
    static bool HasFlags()   { return false; }

    enum {

            DELETED    = 0x0001,		// This bit indicate that the vertex is deleted from the mesh
            NOTREAD    = 0x0002,		// This bit indicate that the vertex of the mesh is not readable
            NOTWRITE   = 0x0004,		// This bit indicate that the vertex is not modifiable
            MODIFIED   = 0x0008,		// This bit indicate that the vertex is modified
            VISITED    = 0x0010,		// This bit can be used to mark the visited vertex
            SELECTED   = 0x0020,		// This bit can be used to select
            BORDER     = 0x0100,    // Border Flag
            USER0      = 0x0200			// First user bit
};

    inline int & UberFlags () { return this->Flags();	}
    inline int UberFlags() const 	{		return this->Flags();	}

    bool IsD() const {return (this->Flags() & DELETED) != 0;} ///  checks if the circle is deleted
    bool IsR() const {return (this->Flags() & NOTREAD) == 0;} ///  checks if the circle is readable
    bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}///  checks if the circle is modifiable
    bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}/// This funcion checks whether the circle is both readable and modifiable
    bool IsS() const {return (this->Flags() & SELECTED) != 0;}///  checks if the circle is Selected
    bool IsB() const {return (this->Flags() & BORDER) != 0;}///  checks if the circle is a border one
    bool IsV() const {return (this->Flags() & VISITED) != 0;}///  checks if the circle Has been visited

    // Operators

    inline bool operator == ( CircleTree const & c )
    {
        return (Circle::operator ==(c)) ;
    }
};

#endif // CIRCLETREE_H
